﻿using System;
using System.Reflection;
using System.Windows.Forms;

namespace ViewCam
{
    public partial class HelpForm : Form
    {
        public HelpForm()
        {
            InitializeComponent();
        }

        #region Declarations
        ViewCamHelper viewcamModule;
        #endregion

        /// <summary>
        /// Handles the Load event of the HelpForm control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void HelpForm_Load(object sender, EventArgs e)
        {
            this.Text = String.Format("Help {0}", AssemblyTitle);
            this.txtLicense.Text = Properties.Resources.License;
            this.txtManual.Text = Properties.Resources.Manual;
            SetTheme();
        }

        /// <summary>
        /// Handles the Click event of the btnClose control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        /// <summary>
        /// Sets the theme.
        /// </summary>
        private void SetTheme()
        {
            viewcamModule = new ViewCamHelper();
            this.BackColor = viewcamModule.SetThemeColor(lblStatus);
        }

        /// <summary>
        /// Gets the assembly title.
        /// </summary>
        /// <value>
        /// The assembly title.
        /// </value>
        public string AssemblyTitle
        {
            get
            {
                object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
                if (attributes.Length > 0)
                {
                    AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
                    if (titleAttribute.Title != "")
                    {
                        return titleAttribute.Title;
                    }
                }
                return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
            }
        }
    }
}
